﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.ObjectModel;
using InterOp;

/// <summary>
/// entry point that provides services related to a social network 
/// </summary>
public class InterOpService: IDisposable
{

    ISocialNetwork _snService;

    //list of social network which services we can use
    public enum ServiceType
    {
        Facebook,
        Flickr,
    }

 
    /// <summary>
    /// instantiate the entry point that provides services related to a social network 
    /// </summary>
    /// <param name="type">name of the social network of the social network which services we can use</param>
    /// <param name="page">he ASP.NET page which has to interoperate with the social network</param>
	public InterOpService(ServiceType type, Page page)
	{
    
        switch (type)
        {
            case ServiceType.Facebook:
                _snService = new FacebookConnection(page);
                break;
            case ServiceType.Flickr:
                _snService = new FlickrConnection(page);
                break;
            default:
                break;
        }
	}

    /// <summary>
    /// import information about a user profile from a social network 
    /// </summary>
    /// <param name="username">username of the social network user whose information we want to retrieve </param>
    /// <returns>set of infomation about the social network user</returns>
    public UserData importProfile(string username)
    {
        return _snService.importProfile(username);
    }


    /// <summary>
    /// import the friend list of a social network user 
    /// </summary>
    /// <param name="username">username of the social network user whose friends we want to retrieve </param>
    /// <returns>list of Ids of the social network friends of the user</returns>
    public List<String> importFriends(string username)
    {
        return _snService.importFriends(username);
    }


    #region IDisposable Members

    public void Dispose()
    {
        _snService.Dispose();
    }

    #endregion
}
